#ifndef ROOM_H
#define ROOM_H
#include <vector>
#include "Session.h"
#include <boost/bind.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <boost/asio.hpp>
#include <iostream>

class Room
{
public:
	void join(SharedSession participant)
	{
		participants_.insert(participants_.end(),participant);
	}

	void leave(SharedSession participant)
	{
		//participants_.erase(participant);
	}

	void broadcast(char* p)
	{
		for (std::vector<SharedSession>::iterator it=participants_.begin();it!=participants_.end();it++)
			(*it)->async_writePacket(p,strlen(p));
		//std::for_each(participants_.begin(), participants_.end(),
		//	boost::bind(&Session::writePacket, _1, boost::ref(p)));
	}
	static Room& getInstance()
	{
		static Room room_;	
		return room_;
	}
private:
	Room(){}
	std::vector<SharedSession> participants_;
	
};
#endif